export async function onRequestGet(context) {
  const games = [
    {
      id: 'snake',
      name: '贪吃蛇',
      description: '经典的贪吃蛇游戏，控制蛇吃食物并避免撞到自己',
      url: '/snake_game/',
      thumbnail: '/snake_game/preview.png',
      category: '休闲益智',
      difficulty: '简单',
      controls: '方向键控制'
    },
    {
      id: 'fish',
      name: '大鱼吃小鱼',
      description: '控制小鱼在海洋中生存，吃掉比自己小的鱼并避开大鱼',
      url: '/fish_game/',
      thumbnail: '/fish_game/preview.png',
      category: '动作冒险',
      difficulty: '中等',
      controls: '鼠标或触摸控制'
    }
  ];

  return new Response(JSON.stringify({
    success: true,
    data: games,
    total: games.length,
    message: '游戏列表获取成功'
  }), {
    headers: {
      'Content-Type': 'application/json; charset=utf-8',
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'GET',
      'Access-Control-Allow-Headers': 'Content-Type',
      'Cache-Control': 'public, max-age=300'
    }
  });
}